package nickthissen.iracing.datamodels;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.lang.reflect.Type;
import java.util.ArrayList;

/**
 * Created by nthissen on 30/05/13.
 */
public class FavThreadsResult extends ResultBase
{
    public ArrayList<FavoriteThread> Object;

    public static FavThreadsResult fromJson(String json)
    {
        Gson g = new Gson();
        DataModel model = g.fromJson(json, DataModel.class);
        return model.d;
    }

    public static FavThreadsResult error(String message, Exception ex)
    {
        FavThreadsResult result = new FavThreadsResult();
        result.Object = null;
        result.Success = false;
        result.Message = message;
        result.DetailMessage = ex.toString();
        result.Exception = ex;
        return result;
    }

    public static FavThreadsResult failed()
    {
        FavThreadsResult result = new FavThreadsResult();
        result.Success = false;
        return result;
    }

    private static class DataModel
    {
        public FavThreadsResult d;
    }
}
